﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace tww
{
    public partial class Page3 : System.Web.UI.Page
    {
        TwitterHelper helper = TwitterHelper.Get;

        protected void Page_Load(object sender, EventArgs e)
        {
            helper.TokenKey = Session["twtoken"].ToString();
            helper.SecretKey = Session["twsecret"].ToString();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            GridView2.DataSource = helper.BeniTakipEtmeyenleriTakipEtme(Convert.ToInt64(Session["TwitterObjectid"]), Session["twname"].ToString());
            GridView2.DataBind();
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Response.Redirect("/Default.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            List<Int64> users = new List<Int64>();
            for (int i = 0; i < GridView2.Rows.Count; i++)
            {
                users.Add(Convert.ToInt64(GridView2.Rows[i].Cells[3].Text));
            }
            helper.unFollowUser(users.ToArray());
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            if (GridView2.SelectedIndex > -1)
            {
                Int64 id = Convert.ToInt64(GridView2.SelectedRow.Cells[3].Text);
                helper.unFollowUser(id);
            }
        }
    }
}